import axios from 'axios'
const http = axios.create({
  baseURL: 'http://112.74.99.5:3000/web/api'
})
http.interceptors.request.use(function(config) {
  // 在发送请求之前做些什么
  if (localStorage.getItem('id') && localStorage.getItem('token')) {
    config.headers.Authorization = 'Beare ' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTE3NjAsImlhdCI6MTYxNDc2MjgzOH0.oT_litsP4u0t3bZSuo7Wt3mHLjsrtNDVaJ-HA4mfxvA'
  }
  return config
}, function(error) {
  // 对请求错误做些什么
  return Promise.reject(error)
})
export default http
